<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <canvas id="canvas" width="400" height="400"></canvas>
  <script>
    /** @type {HTMLCanvasElement} */
    var canvas=document.querySelector("#canvas")
    var ctx=canvas.getContext("2d")
    ctx.lineWidth=5
    ctx.lineJoin="round"
    ctx.strokeStyle="skyblue"
    var i=0
    setInterval(function(){
      i++
      // console.log(i);
      ctx.clearRect(0,0,400,400)
      ctx.lineDashOffset=i
    ctx.setLineDash([5,5])
    // var get=ctx.getLineDash()
    // console.log(get);
    ctx.strokeRect(100,100,200,200)
    },10)
    
  </script>
</body>
</html>